{config_load file=global.conf}
{config_load file="_Tracks.conf" section="`$lang`"}
{*=====================================================================================*}
<table border="0" cellpadding="2" cellspacing="0">

    <tr>
        <td valign="top">

<table border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff">
{*=====================================================================================*}
{* Header *}
   <tr>
    <td width="55">
        <b>{#_Tracks__labelPeriod#}{*Period*}</b>
    </td>

    {foreach key="ItemID" name="items" item="itemOne" from=$itemsArr}
        {if $flagShowColumnAll || $ItemID } {* show or not column ALL *}
        <td align="right" width="80">
            <nobr>
                &nbsp;
                {if 'system'==$mode}
                    <b><a onclick="xajax_showTrackRecord(0, '{$ItemID}');">{$itemOne.Name}</a></b>
                {else}
                    <b>&nbsp;{$itemOne.Name}</b>
                {/if}
                &nbsp;
            </nobr>
        </td>
        {/if} {* /show or not column ALL *}
    {/foreach}

   </tr>
{* /Header *}
{*=====================================================================================*}
{assign var="first" value="1"}
{assign var="last_year" value=""}
{foreach key="DateKey" name="dates" item="itemDate" from=$datesArr}

        {if $itemDate.Year<>$last_year}
            {if 0==$first} <tr><td colspan="2" style="font-size:6px; font-family:Verdana, Arial, Helvetica, sans-serif; ">&nbsp;</td></tr>{/if}
            {assign var="last_year" value="`$itemDate.Year`"}
        {/if}

  <tr id="trackrecord__row_{$TradeID}_{$itemDate.Start}_{$itemDate.Finish}">
    {* date value *}
    <td	{if $smarty.foreach.dates.iteration%2==1} class="darkRow" {/if}><nobr>
        {* normal value *}
        <div id="trackcell_0_{$itemDate.Start}_{$itemDate.Finish}_date_normal" style="padding:2px 3px 3px 2px;">
            {$itemDate.Date}
        </div>
        {* / normal value *}
        {* selected value *}
        <div id="trackcell_0_{$itemDate.Start}_{$itemDate.Finish}_date_selected" style="color:#ffffff;background-color:#477ab1;padding:2px 3px 3px 2px;display:none">
            {$itemDate.Date}
        </div>
        {* /selected value *}
        </nobr>
    </td>
    {* /date value *}
    {assign var="no" value=`$smarty.foreach.dates.iteration`}
    {* calculated value *}
    {foreach key="ItemID" name="items" item="itemOne" from=$itemsArr}
        {if $flagShowColumnAll || $ItemID } {* show or not column ALL *}
            {assign var="sys_no" value=`$systemByNoInd.$ItemID`}
            <td {if $smarty.foreach.dates.iteration%2==1} class="darkRow" {/if} align="right">
                {* normal value *}
                <div style="padding:2px 3px 3px 2px;" id="trackcell_{$ItemID}_{$itemDate.Start}_{$itemDate.Finish}_normal">
                    {if 'system'!=$mode }
                    <a style="text-decoration:underline;Cursor: pointer;"
                                onClick="javascripts:xajax_showTrackRecordForecasts({$ItemID},'{$itemDate.Start}','{$itemDate.Finish}', '{$itemDate.Active}', '{$SystemID}', '{$mode}');">
                        <span id="trackcellvalue_{$ItemID}_{$itemDate.Start}_{$itemDate.Finish}_normal">{$data.$DateKey.$ItemID|default:'-'}</span>
                    </a>
                    {else}
                        <span id="trackcellvalue_{$ItemID}_{$itemDate.Start}_{$itemDate.Finish}_normal">
                            {if $systemsArr.$sys_no.Paused } <font color="#878787"> {/if}
                            {$data.$DateKey.$ItemID|default:'-'}
                            {if $systemsArr.$sys_no.Paused } </font> {/if}
                        </span>
                    {/if}
                </div>
                {* / normal value *}
                {* selected value *}
                <div style="color:#ffffff;background-color:#477ab1;padding:2px 3px 3px 2px;display:none" id="trackcell_{$ItemID}_{$itemDate.Start}_{$itemDate.Finish}_selected">
                    <span id="trackcellvalue_{$ItemID}_{$itemDate.Start}_{$itemDate.Finish}_selected">{$data.$DateKey.$ItemID}</span>
                </div>
                {* /selected value *}
            </td>
            {assign var="first" value="0"}
        {/if} {* /show or not column ALL *}
    {/foreach}
    {* /calculated value *}
  </tr>

{/foreach}

{*=====================================================================================*}
{* Footer *}
   <tr>
      <td><b>Total:</b></td>
  {foreach key="ItemID" name="items" item="itemOne" from=$itemsArr}
    {if $flagShowColumnAll || $ItemID } {* show or not column ALL *}
    {assign var="sys_no" value=`$systemByNoInd.$ItemID`}
        <td align="right"  >
            <b>
                <span id="trackcellvalue_{$ItemID}_total">
                    {if $systemsArr.$sys_no.Paused } <font color="#878787"> {/if}
                    &nbsp;{$totalsArr.$ItemID.pips}
                    {if $systemsArr.$sys_no.Paused } </font> {/if}
                </span>
            </b>
        </td>
    {/if} {* /show or not column ALL *}
  {/foreach}
   </tr>
{* /Footer *}
{*=====================================================================================*}
</table>

{* Loading visualisation block *}
</td>
<td width="10" valign="top" align="right">
    &nbsp;
    <div id="loadingTrackMessage" style="display: none;">
        <img src="{#images_dir#}/loading.gif">
    </div>
    &nbsp;
</td>
</td>
<td  valign="top">

<div id="divTrackForecasts"></div>
</td>
</tr>
    </table>
{literal}
<script type="text/javascript">
<!--

    function showLoadingMessage() {
        xajax.$('loadingMessage').style.display='none';
        xajax.$('loadingTrackMessage').style.display='block';
    }//showLoadingMessage

    function hideLoadingMessage() {
        xajax.$('loadingMessage').style.display='none';
        xajax.$('loadingTrackMessage').style.display='none';
    }//hideLoadingMessage


    xajax.loadingFunction = showLoadingMessage;
    xajax.doneLoadingFunction = hideLoadingMessage;
    // -->
</script>
{/literal}
{* /Loading visualisation block *}
